//
//  SuggestViewController.m
//  NewChat
//
//  Created by 马欢 on 16/2/27.
//  Copyright © 2016年 蓝鸥. All rights reserved.
//

#import "SuggestViewController.h"

@interface SuggestViewController ()<UITextViewDelegate>
@property (nonatomic,strong)UILabel *uilabel;
@end

@implementation SuggestViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.title = @"意见反馈";
    self.edgesForExtendedLayout = UIRectEdgeNone;
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"取消" style:(UIBarButtonItemStylePlain) target:self action:@selector(backAction:)];
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"提交" style:(UIBarButtonItemStylePlain) target:self action:@selector(backAction:)];

//    初始化UITextView
    //首先定义UITextView
    UITextView *textView = [[UITextView alloc]initWithFrame:CGRectMake(0, 10, [UIScreen mainScreen].bounds.size.width, 160)];
    textView.font = [UIFont systemFontOfSize:20];
    textView.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:textView];
    textView.hidden = NO;
    textView.delegate = self;
    //其次在UITextView上面覆盖个UILable,UILable设置为全局变量
    self.uilabel = [[UILabel alloc]init];
    self.uilabel.frame =CGRectMake(5, 10, [UIScreen mainScreen].bounds.size.width, 40);
    self.uilabel.font = [UIFont systemFontOfSize:20];
    self.uilabel.text = @"   有什么不爽的，马上吐槽吧～";
    self.uilabel.enabled = NO;//lable必须设置为不可用
    self.uilabel.backgroundColor = [UIColor clearColor];
    [self.view addSubview:self.uilabel];

//    UITextField *userNameField = [[UITextField alloc]initWithFrame:CGRectMake(0, 180, [UIScreen mainScreen].bounds.size.width, 40)];
//    userNameField.placeholder = @"     邮箱／QQ／手机";
//    userNameField.backgroundColor = [UIColor whiteColor];
//    [self.view addSubview:userNameField];
}

//    实现UITextView的代理
-(void)textViewDidChange:(UITextView *)textView
{
//        self.examineText = textView.text;
        if (textView.text.length == 0) {
            self.uilabel.text = @"有什么不爽的，马上吐槽吧～";

        }else{
            self.uilabel.text = @"";
        }
}

-(void)viewWillAppear:(BOOL)animated{
    self.view.backgroundColor = [UIColor colorWithRed:245/255.0 green:245/255.0 blue:245/255.0 alpha:1];
    [self.tabBarController.tabBar setHidden:YES];
}

-(void)backAction:(UIBarButtonItem *)sender{
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
